<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [1, 3, 5, 7, 9];
        var res = [];

        for (var i = 0; i < arr.length; i++) {
            res.unshift(arr[i]);
        }
        console.log(res);
        // // 冒泡换个符号
        // //1. 翻转数组  [1,3,5,7,9]++>[9,7,5,3,1]
        // var arr = [1, 3, 5, 7, 9];
        // for (var j = 1; j < arr.length; j++) {
        //     for (var i = 0; i < arr.length - 1; i++) {
        //         if (arr[i] < arr[i + 1]) {
        //             var arr1 = arr[i];
        //             arr[i] = arr[i + 1];
        //             arr[i + 1] = arr1;
        //         }
        //     }
        // }

        // console.log(arr);



    </script>
</body>

</html>